
#pragma once
#include "SocketExport.h"

namespace Apo
{
    //! Ogitor System class
    /*!  
        A class that is responsible for handling UI dialogs, maintenance of tree view widget and extra utility functions
    */
	class  SkinSystem;
	extern SocketClientLibExport SkinSystem *gSkinSystem;
	// BINDINGS is used to define BINDINGS between PropertyGrid and Functions of
	// Editor Classes, String value is converted to a Function ID using this list
	typedef HashMap<btHashString, unsigned int> BindingMap;
	typedef AlignedObjectArray<String> stringvector;
	
	class OGUIWidget;

	class  SocketClientLibExport  SkinSystem /*: public SkinSystem*/
	{
	public:
		SkinSystem();
		virtual ~SkinSystem();
             
		//about render windows
		virtual void * getWindowsPoint() = 0;

		unsigned int GetBindingValue(String arg);
		void         InitBindings();
		String       QualifyPath(const String &dirname);
		String       GetRelativePath(const String pathFrom,const String pathTo);
		void         ParseStringVector(String &str, StringVector &list);
		void         CleanPath(String &path);
		String       ExtractFileName(const String &path);
		String		 ExtractFilePath(const String &path);

		virtual bool CopyFilesEx(String source, String destination) = 0;
		virtual bool MakeDirectory(String dirname) = 0;
		virtual String GetExePath() = 0;
		virtual void DeleteFile(const String &file) = 0;
		virtual void RenameFile(const String &oldname, const String &newname) = 0;
		virtual void GetFileList(String path, StringVector &list) = 0;
		virtual String DisplayOpenDialog(String title, StringVector ExtensionList) = 0;
		virtual String DisplaySaveDialog(String title, StringVector ExtensionList) = 0;
		virtual DIALOGRET    DisplayMessageDialog(String msg, DIALOGTYPE dlgType) = 0;
		virtual bool         DisplayETLDialog(NameValuePairList &params) = 0;

		virtual void         UnLoadPropertySheets() = 0;
		virtual void         LoadPropertySheet(int idx, String filename) = 0;
		virtual bool         HasTreeView() = 0;
		virtual bool         HasPropertiesView() = 0;
		virtual bool         ClearPropertiesView(unsigned int ID) = 0;
		virtual void         SelectTreeItem(String name) = 0;
		virtual void         EditCurrentTreeItem() = 0;
		virtual void *       InsertTreeItem(String parent,String name,int iconid, unsigned int colour) = 0;
		virtual void *       InsertTreeItem(void *parent,String name,int iconid, unsigned int colour) = 0;
		virtual void         SetTreeItemText(String oldname, String newname) = 0;
		virtual void         DeleteTreeItem(String name) = 0;
		virtual void *       CreateTreeRoot(String name) = 0;
		virtual void         SetTreeItemColour(String name, unsigned int colour ) = 0;
		virtual void         ClearTreeItems() = 0;


		virtual void	       ClearProperty(void *caller, int idx) = 0;
		virtual void         EnableProperty(void *caller,int idx, bool enable) = 0;
		virtual String GetStringProperty(void *caller,int idx) = 0;
		virtual int          GetIntProperty(void *caller,int idx) = 0;
		virtual float        GetFloatProperty(void *caller,int idx) = 0;
		virtual bool         GetBoolProperty(void *caller,int idx) = 0;
		virtual unsigned int GetColourProperty(void *caller,int idx) = 0;
		virtual bool         SetProperty(void *caller,int idx,String value) = 0;
		virtual bool         SetProperty(void *caller,int idx,int value) = 0;
		virtual bool         SetProperty(void *caller,int idx,float value) = 0;
		virtual bool         SetProperty(void *caller,int idx,bool value) = 0;
		virtual bool         SetProperty(void *caller,int idx,Vector2 value) = 0;
		virtual bool         SetProperty(void *caller,int idx,Vector3 value) = 0;
		//virtual bool         SetProperty(void *caller,int idx,Vector4 value) = 0;
		virtual bool         SetProperty(void *caller,int idx,Quaternion value) = 0;
		virtual bool         SetColourProperty(void *caller,int idx,unsigned long value) = 0;
		virtual void         FillPropertyOptions(void *caller,int idx, StringVector &optlist) = 0;
		virtual void         CreateGroupProperty(void *caller,int idxparent, int idxnew, String namenew, bool valuelist = true) = 0;
		virtual void         CreateStringProperty(void *caller,int idxparent, int idxnew, String namenew) = 0;
		virtual void         CreateIntProperty(void *caller,int idxparent, int idxnew, String namenew) = 0;
		virtual void         CreateFloatProperty(void *caller,int idxparent, int idxnew, String namenew, String format = "%.2f") = 0;
		virtual void         CreateBoolProperty(void *caller,int idxparent, int idxnew, String namenew) = 0;
		virtual void         CreateFileProperty(void *caller,int idxparent, int idxnew, String namenew,String &FileSelecttype,String &Filetype,const String& szDescr ) = 0;
		virtual void         CreateColourProperty(void *caller,int idxparent, int idxnew, String namenew) = 0;


		virtual void         ExpandProperty(void *caller,int idx, bool expand) = 0;

		virtual void         SetMouseCursor(unsigned int cursor) {};
		virtual void         SetMousePosition(Vector2 position) {};
		virtual void         ShowMouseCursor(bool bShow) {};

		virtual void         SetGUIControlIndex(OGUIWidget *widget, int IDX) {};
		virtual void         SetGUIControlText(OGUIWidget *widget, String text) {};
		virtual int          GetGUIControlIndex(OGUIWidget *widget) {return -1;};
		virtual String  GetGUIControlText(OGUIWidget *widget) {return "";};
		virtual void         SetGUIControlItems(OGUIWidget *widget, stringvector items) {};

	protected:
		BindingMap m_Bindings;
	};

    //! Dummy class
    /*!  
        Dummy class with empty implementations
        @deprecated
    */
    class OgitorsDummySystem: public SkinSystem
    {
    public:
        /**
        * @copydoc SkinSystem::SkinSystem()
        */
        OgitorsDummySystem() {};
        /**
        * @copydoc SkinSystem::~SkinSystem()
        */
        virtual ~OgitorsDummySystem() {};
        /**
        * @copydoc SkinSystem::FileExists(const Str&)
        */
        virtual bool FileExists(const Str& filename) {return false;};
        /**
        * @copydoc SkinSystem::CopyFile(Str, Str)
        */
        virtual bool CopyFile(Str source, Str destination) {return false;};
        /**
        * @copydoc SkinSystem::CopyFilesEx(Str, Str)
        */
        virtual bool CopyFilesEx(Str source, Str destination) {return false;};
        /**
        * @copydoc SkinSystem::MakeDirectory(Str)
        */
        virtual bool MakeDirectory(Str dirname) {return false;};
        /**
        * @copydoc SkinSystem::GetExePath()
        */
        virtual Str GetExePath() {return "./";};
        /**
        * @copydoc SkinSystem::getProjectsDirectory()
        */
        virtual Str getProjectsDirectory() {return "./";};
        /**
        * @copydoc SkinSystem::DeleteFile(const Str&)
        */
        virtual void DeleteFile(const Str &file) {};
        /**
        * @copydoc SkinSystem::RenameFile(const Str&, const Str&)
        */
        virtual void RenameFile(const Str &oldname, const Str &newname) {};
        /**
        * @copydoc SkinSystem::GetFileList(Str, StringVector&)
        */
        virtual void GetFileList(Str path, StringVector &list) {list.clear();};
        /**
        * @copydoc SkinSystem::DisplayDirectorySelector(WStr)
        */
        virtual Str DisplayDirectorySelector(WStr title) {return "";};
        /**
        * @copydoc SkinSystem::DisplayOpenDialog(WStr, UTFStringVector&)
        */
        virtual Str DisplayOpenDialog(WStr title, UTFStringVector ExtensionList) {return "";};
        /**
        * @copydoc SkinSystem::DisplaySaveDialog(WStr, UTFStringVector&)
        */
        virtual Str DisplaySaveDialog(WStr title, UTFStringVector ExtensionList) {return "";};
        /**
        * @copydoc SkinSystem::DisplayMessageDialog(WStr, DIALOGTYPE)
        */
        virtual DIALOGRET    DisplayMessageDialog(WStr msg, DIALOGTYPE dlgType) {return DLGRET_CANCEL;};
        /**
        * @copydoc SkinSystem::DisplayTerrainDialog(NameValuePairList&)
        */
        virtual bool         DisplayTerrainDialog(NameValuePairList &params) {return false;};
        /**
        * @copydoc SkinSystem::DisplayImportHeightMapDialog(NameValuePairList)
        */
        virtual bool         DisplayImportHeightMapDialog(NameValuePairList &params) {return false;};
        /**
        * @copydoc SkinSystem::DisplayCalculateBlendMapDialog(NameValuePairList)
        */
        virtual bool         DisplayCalculateBlendMapDialog(NameValuePairList &params) {return false;};
        /**
        * @copydoc SkinSystem::UpdateLoadProgress(float percentage, WStr msg)
        */
        virtual void         UpdateLoadProgress(float percentage, WStr msg) {};
        /**
        * @copydoc SkinSystem::HasTreeView()
        */
        virtual bool         HasTreeView() {return false;};
        /**
        * @copydoc SkinSystem::HasPropertiesView()
        */
        virtual bool         HasPropertiesView() {return false;};
        /**
        * @copydoc SkinSystem::PresentPropertiesView()
        */
        virtual void         PresentPropertiesView(CBaseEditor *object) {};
        /**
        * @copydoc SkinSystem::SelectTreeItem(void *)
        */
        virtual void         SelectTreeItem(CBaseEditor *object) {};
        /**
        * @copydoc SkinSystem::InsertTreeItem(CBaseEditor *, CBaseEditor *, int, unsigned int)
        */
        virtual void         InsertTreeItem(CBaseEditor *parent, CBaseEditor *object, int iconid, unsigned int colour) {};
        /**
        * @copydoc SkinSystem::MoveTreeItem(void *, void *)
        */
        virtual void *       MoveTreeItem(void *newparent, void *object) { return 0; }
        /**
        * @copydoc SkinSystem::MoveTreeItem(int, CBaseEditor *)
        */
        virtual void         MoveLayerTreeItem(int newparent, CBaseEditor *object) {};
        /**
        * @copydoc SkinSystem::CreateTreeRoot(Str)
        */
        virtual void *       CreateTreeRoot(Str name) {return 0;};
        /**
        * @copydoc SkinSystem::SetTreeItemText(CBaseEditor *, Str)
        */
        virtual void         SetTreeItemText(CBaseEditor *object, Str newname) {};
        /**
        * @copydoc SkinSystem::SetTreeItemColour(CBaseEditor *, unsigned int)
        */
        virtual void         SetTreeItemColour(CBaseEditor *object, unsigned int colour) {};
        /**
        * @copydoc SkinSystem::DeleteTreeItem(CBaseEditor *)
        */
        virtual void         DeleteTreeItem(CBaseEditor *object) {};
        /**
        * @copydoc SkinSystem::ClearTreeItems()
        */
        virtual void         ClearTreeItems() {};
    };
}
